<?php

class Escola extends CI_Model{

	var $id = '';
	var $nome = '';


	function __construct()
    {
        parent::__construct();
    }


    function salvar(){
    	$this->id = $this->input->post('id');
    	$this->nome = $this->input->post('nome');
    	
    	if($id == ''){
    		$this->db->insert('escolas', this);
    	} else{
    		$this->db->update('escolas', this, array('id' => $this->id));
    	}
    }
    
    function listar(){
    	$this->db->get('escolas');
    }

}


?>